//
//  ViewController.m
//  UI_16_AutomaticallyAdjusts
//
//  Created by li cheng on 16/8/4.
//  Copyright © 2016年 li cheng. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *myTableView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.automaticallyAdjustsScrollViewInsets = NO;
    
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"pool"];
    cell.textLabel.text = @"天马流星拳!!";
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSLog(@"点击呵呵");
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
//    NSIndexPath *index = [tableView indexPathForCell:cell];
    NSLog(@"点击---%@", cell.textLabel.text);
}
// 当触发segue的时候,会调用这个方法,类似于button点击方法
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    UITableViewCell *cell = sender;
    segue.destinationViewController.title = cell.textLabel.text;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
